	<table cellspacing="0" cellpadding="0" border="0" class="fieldset" id="feed">
		<tbody>
			<tr>
				<td class="label"><label for="feed_name">Feed name</label></td>
				<td class="field"><%= f.text_field :name, :class => "textbox", :size => 100 %></td>
				<td class="help">Required.</td>
			</tr>
			<tr>
				<td class="label"><label for="feed_url">URL</label></td>
				<td class="field"><%= f.text_field :url, :class => "textbox", :size => 100 %></td>
				<td class="help">Required. Please use a valid feed URL.</td>
			</tr>
			<tr>
				<td class="label"><label for="feed_url">Update interval</label></td>
				<td class="field">
					<%
						interval = {}
						interval[:units] = "m"
						interval[:count] = @feed[:update_interval]/60
						if @feed[:update_interval]%3600 == 0
							interval[:units] = "h"
							interval[:count] = @feed[:update_interval]/3600
						elsif @feed[:update_interval]%86400 == 0
							interval[:units] = "d"
							interval[:count] = @feed[:update_interval]/86400
						end
					-%>
					<%= f.hidden_field :update_interval %>
					<%= text_field_tag "interval[count]", interval[:count], :size => 5 %>
					<%= select_tag "interval[units]", options_for_select([["minutes","m"],["hours","h"],["days","d"]],interval[:units]) %>
				</td>
				<td class="help">How often you would like to update your feed?</td>
			</tr>
		</tbody>
	</table>
	<% if !@feed.new_record? -%><p>Last updated at <small><%= timestamp @feed[:updated_at] %></small> - with HTTP status code <% if @feed[:status]==200 -%><span style="color:green;font-weight:bold"><% else -%><span style="color:red;font-weight:bold"><% end -%><%= @feed[:status] %></span>.</p><% end -%>
	<p class="buttons">
    <%= save_model_button(@feed) %> or <%= link_to "Cancel", feeds_path %>
	</p>
	<script type="text/javascript">
		Event.observe(window,"load",function(){
			Event.observe(document.forms[0],"submit", function(){
				var interval = parseInt($F("interval[count]"));
				if ($F("interval[units]")=="m") $("feed_update_interval").value = interval * 60;
				if ($F("interval[units]")=="h") $("feed_update_interval").value = interval * 3600;
				if ($F("interval[units]")=="d") $("feed_update_interval").value = interval * 86400;
			});
		});
	</script>
